package org.example.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class RedisService {
    @Autowired
    private RedisTemplate<String, Map<String, List<String>>> redisTemplate;

    // 将 Map 存入 Redis
    public void saveMap(String key, Map<String, List<String>> map) {
        redisTemplate.opsForValue().set(key, map);
    }

    // 从 Redis 获取 Map
    public Map<String, List<String>> getMap(String key) {
        return redisTemplate.opsForValue().get(key);
    }
}
